﻿//cesium 三维的影响结构数据 -->
//健康卫生

var chartjkws = (function () {
    // 初始化
    function chartjkws() {
        // 属性

    };

    ////
    chartjkws.prototype.init = function (options) {
        this.etsl();
        this.wsjg();
    }
    /*
   卫生机构数量
   */
    chartjkws.prototype.wsjg = function (options) {
        //社区卫生服务机构，医院，社保定点医院
       
        var option = {
            backgroundColor: 'rgba(0,0,0,0)',
            series: [{
                type: 'pie',
                center: ['50%', '35%'],
                radius: ['39%', '52%'],
                silent: true,
                data: [{
                    value: 1,
                    itemStyle: {
                        normal: {
                            color: '#050f58',
                            borderColor: '#162abb',
                            borderWidth: 0,
                            shadowBlur: 50,
                            shadowColor: 'rgba(21,41,185,.75)'
                        }
                    }
                }]
            }, {
                    type: 'pie',
                    center: ['50%', '35%'],
                    radius: ['39%', '52%'],
                    silent: true,
                    label: {
                        normal: {
                            show: false,
                        }
                    },
                    data: [{
                        value: 1,
                        itemStyle: {
                            normal: {
                                color: '#050f58',
                                shadowBlur: 50,
                                shadowColor: 'rgba(21,41,185,.75)'
                            }
                        }
                    }]
                }, {
                    name: '医疗设备数量',
                    type: 'pie',
                    center: ['50%', '35%'],
                    radius: ['39%', '52%'],
                    hoverAnimation: true,

                    data: [{
                        value: 1000,
                        name: "社区医院",
                        center: ['50%', '35%'],
                        itemStyle: {
                            normal: {
                                label: {
                                    show: false,
                                    textStyle: {
                                        fontSize: 15,
                                        fontWeight: "bold"
                                    },
                                    position: "center"
                                },
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: 'rgba(5,193,255,1)'
                                }, {
                                        offset: 1,
                                        color: 'rgba(15,15,90,1)'
                                    }])
                            }
                        } 
                    }, {
                            value: 1000,
                            name: "医院",
                            center: ['50%', '35%'],
                            itemStyle: {
                                normal: {
                                    label: {
                                        show: false,
                                        textStyle: {
                                            fontSize: 15,
                                            fontWeight: "bold"
                                        },
                                        position: "center"
                                    },
                                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                        offset: 0,
                                        color: 'rgba(5,15,88,1)'
                                    }, {
                                            offset: 1,
                                            color: 'rgba(235,122,255,1)'
                                        }])
                                }
                            }                            
                        }, {
                            value: 1000,
                            name: "医疗定点医院",
                            center: ['50%', '35%'],
                            itemStyle: {
                                normal: {
                                    label: {
                                        show: false,
                                        textStyle: {
                                            fontSize: 15,
                                            fontWeight: "bold"
                                        },
                                        position: "center"
                                    },
                                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                        offset: 0,
                                        color: 'rgba(5,15,88,1)'
                                    }, {
                                            offset: 1,
                                            color: 'rgba(235,122,255,1)'
                                        }])
                                }
                            }
                        }]
                }, {
                    name: '',
                    type: 'pie',
                    center: ['50%', '35%'],
                    clockWise: true,
                    hoverAnimation: false,
                    radius: [200, 200],
                    label: {
                        normal: {
                            position: 'center'
                        }
                    },
                    data: [{
                        value: 0,
                        label: {
                            normal: {
                                formatter: '38',
                                textStyle: {
                                    color: '#fe8b53',
                                    fontSize: 25,
                                    fontWeight: 'bold'
                                }
                            }
                        }
                    }, {
                            tooltip: {
                                show: false
                            },
                            label: {
                                show: false,
                                normal: {
                                    formatter: '\n人均医疗设备数',
                                    textStyle: {
                                        color: '#bbeaf9',
                                        fontSize: 14
                                    }
                                }
                            }
                        }]
                }]
        };
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('vpc19ccmychartbox2'));
        myChart.setOption(option);
    }
    /*
    育龄妇女小孩数量
    */
    chartjkws.prototype.etsl = function (options) {
        var datas= [[],[],[]];
        var categorys = [];

        
        var option = {
            backgroundColor: 'rgba(0,0,0,0)',
            /* legend: {
                bottom: 20,
                textStyle: {
                    color: '#fff',
                },
                data: ['钥匙量', '有效房源量']
            },*/
            grid: {
                left: '3%',
                right: '4%',
                bottom: '10%',
                containLabel: true
            },

            tooltip: {
                show: "true",
                trigger: 'axis',
                axisPointer: {
                    // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            xAxis: {
                type: 'value',
                axisTick: { show: false },
                axisLine: {
                    show: false,
                    lineStyle: {
                        color: '#2B80CF',
                    }
                },
                splitLine: {
                    show: false
                },
                axisLabel: { show: false },
            },
            yAxis: [
                {
                    type: 'category',
                    axisTick: { show: false },
                    axisLine: {
                        show: false,
                        lineStyle: {
                            color: '#2B80CF',
                        }
                    },

                    data: categorys
                } 
            ],
            series: [
                {
                    name: '一孩率',
                    type: 'bar',
                    stack: '总量',
                    itemStyle: {
                        normal: {
                            show: true,
                            color: '#277ace',
                            barBorderRadius: 0,
                            borderWidth: 0,
                            borderColor: '#333',
                        }
                    },
                    barGap: '0%',
                    barCategoryGap: '50%',
                    data: datas[0]
                },
                {
                    name: '二孩率',
                    type: 'bar',
                    stack: '总量',
                    itemStyle: {
                        normal: {
                            show: true,
                            color: '#5de3e1',
                            barBorderRadius: 0,
                            borderWidth: 0,
                            borderColor: '#333',
                        }
                    },
                    barGap: '0%',
                    barCategoryGap: '50%',
                    data: datas[1]
                },
                {
                    name: '多孩率',
                    type: 'bar',
                    stack: '总量',
                    itemStyle: {
                        normal: {
                            show: true,
                            color: '#00FFE6',
                            barBorderRadius: 0,
                            borderWidth: 0,
                            borderColor: '#333',
                        }
                    },
                    barGap: '0%',
                    barCategoryGap: '50%',
                    data: datas[2]
                }
            ]
        };

        $.getJSON("datas/gz_wjw_gqxjsjhsyqk.json", function (result) {
            // 基于准备好的dom，初始化echarts实例
            $.each(result, function (i, val) {
                categorys.push(val.QX);
                datas[0].push(parseFloat(val.YHL));
                datas[1].push(parseFloat(val.EHL));
                datas[2].push(parseFloat(val.DHL));
            });

            var myChart = echarts.init(document.getElementById('vpc19ccmychartbox1'));
            myChart.setOption(option);

            var myChart1 = echarts.init(document.getElementById('vpc20ccmychartbox1'));
            myChart1.setOption(option); 

            var myChart2 = echarts.init(document.getElementById('vpc16ccmychartbox1'));
            myChart2.setOption(option); 
           
        });

    

    }
    // 返回
    return chartjkws;
})();